<template>
  <view class="container">
    <view class="title">我的评价</view>
    <view class="txt" v-if="Object.values(obj).length != 0">
      <view class="content">
        {{ obj.content }}
      </view>
      <uni-rate v-model="obj.star" :readonly="true" activeColor="#F34915" color="#ccc" :isFill="false" />
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      rateValue: 3,
      id: '',
      obj: []
    };
  },
  methods: {
    async getdetail() {
      const res = await uni.$http.post('/evaluates/list', {
        // order_id: id,
        // content: '',
        // star: ''
        type: '1'
      });
      console.log('详情', res.data.data.list);
      res.data.data.list.forEach((item) => {
        if (item.order_id == this.id) {
          this.obj = item;
        }
      });
      console.log(this.obj);
    }
  },

  onLoad(e) {
    if (e.id) {
      console.log(e.id);
      this.id = e.id;
      this.getdetail();
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  padding: 30rpx;
  .title {
    font-family: PingFang SC, PingFang SC;
    font-weight: bold;
    font-size: 30rpx;
    color: #333333;
    padding-left: 20rpx;
    border-left: 8rpx solid #3553e8;
  }
  .txt {
    box-sizing: border-box;
    width: 690rpx;
    padding: 30rpx;
    background: #ffffff;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    border: 2rpx solid #f1f1f1;
    margin-top: 30rpx;
    .content {
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 28rpx;
      color: #333333;
      padding-bottom: 30rpx;
    }
  }
}
</style>
<style>
page {
  background-color: #f9f9f9;
}
</style>
